package cn.com.dcsgo.design.pattern.factory.simple;

import cn.com.dcsgo.design.pattern.factory.product.Book;
import cn.com.dcsgo.design.pattern.factory.product.ChineseBook;
import cn.com.dcsgo.design.pattern.factory.product.EnglishBook;
import cn.com.dcsgo.design.pattern.factory.product.MathBook;

/**
 * BookFactory
 *
 * @author Dcsgo
 * @since 29/5/2025 下午 5:19
 */

public class BookFactory {
    public enum BookType {
        /**
         * 语文
         */
        CHINESE,
        /**
         * 数学
         */
        MATH,
        /**
         * 英语
         */
        ENGLISH,
    }

    public static Book getBook(BookType bookType) {
        return switch (bookType) {
            case CHINESE -> new ChineseBook();
            case MATH -> new MathBook();
            case ENGLISH -> new EnglishBook();
        };
    }
}
